package com.mecuros.common.security.component;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET;

/**
 * @author yujianbo
 * @Classname CarlosSecurityMessageSourceConfiguration
 * @Description 注入自定义错误处理
 * @Date 2022/4/28 9:15 下午
 */
@ConditionalOnWebApplication(type = SERVLET)
public class CarlosSecurityMessageSourceConfiguration {
    @Bean
    public MessageSource securityMessageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.addBasenames("classpath:org/springframework/security/messages");
        return messageSource;
    }

}
